package leetcode20210929;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LUYAO
 * Date: 2021-09-29
 * Time: 21:39
 */
public class ReplaceBlank {
    public static void main(String[] args) {
        Solution1 s1 = new Solution1();
        String t1 = s1.replaceSpace("s e r t");
        System.out.println(t1);

    }
}

class Solution1 {
    public String replaceSpace(String s) {
        StringBuilder builder = new StringBuilder();
        for(Character c : s.toCharArray()){
            if(c == ' '){
                builder.append("%20");
            }
            else builder.append(c);
        }
        String res = builder.toString();
        return res;
    }
}
